﻿$(function () {
	//背景颜色变化
	var R_HQ = 0;
	var G_HQ = 204;
	var B_HQ = 255;
	var time1_RGB_HQ = setInterval(function () { });
	var time2_RGB_HQ = setInterval(function () { });
	$(".YanZ").mouseenter(function () {
		clearInterval(time2_RGB_HQ);
		time1_RGB_HQ = setInterval(function () {
			if (R_HQ <= 255) {
				R_HQ++;
			}
			if (G_HQ >= 0) {
				G_HQ--;
			}
			if (B_HQ >= 0) {
				B_HQ--;
			}
			$(".YanZ").css("background-color", "rgba(" + R_HQ + "," + G_HQ + "," + B_HQ + ",0.5)")
			if (R_HQ >= 255 && G_HQ <= 0 && B_HQ <= 0) {
				clearInterval(time1_RGB_HQ);
			}
		}, 1)
	}).mouseleave(function () {
		clearInterval(time1_RGB_HQ);
		time2_RGB_HQ = setInterval(function () {
			if (R_HQ >= 0) {
				R_HQ--;
			}
			if (G_HQ <= 204) {
				G_HQ++;
			}
			if (B_HQ <= 255) {
				B_HQ++;
			}
			$(".YanZ").css("background-color", "rgba(" + R_HQ + "," + G_HQ + "," + B_HQ + ",0.5)")
			if (R_HQ <= 0 && G_HQ >= 204 && B_HQ >= 255) {
				clearInterval(time2_RGB_HQ);
			}
		}, 1)
	})
	//文字颜色变化
	var R_HQ_WZ = 102;
	var G_HQ_WZ = 102;
	var B_HQ_WZ = 102;
	var time1_RGB_HQ_WZ = setInterval(function () { });
	var time2_RGB_HQ_WZ = setInterval(function () { });
	$(".YanZ").mouseenter(function () {
		clearInterval(time2_RGB_HQ_WZ);
		time1_RGB_HQ_WZ = setInterval(function () {
			if (R_HQ_WZ <= 255) {
				R_HQ_WZ++;
			}
			if (G_HQ_WZ <= 255) {
				G_HQ_WZ++;
			}
			if (B_HQ_WZ <= 255) {
				B_HQ_WZ++;
			}
			$(".YanZ").css("color", "rgb(" + R_HQ_WZ + "," + G_HQ_WZ + "," + B_HQ_WZ + ")")
			if (R_HQ_WZ >= 255 && G_HQ_WZ >= 255 && B_HQ_WZ >= 255) {
				clearInterval(time1_RGB_HQ_WZ);
			}
		})
	}).mouseleave(function () {
		clearInterval(time1_RGB_HQ_WZ);
		time2_RGB_HQ_WZ = setInterval(function () {
			if (R_HQ_WZ >= 102) {
				R_HQ_WZ--;
			}
			if (G_HQ_WZ >= 102) {
				G_HQ_WZ--;
			}
			if (B_HQ_WZ >= 102) {
				B_HQ_WZ--;
			}
			$(".YanZ").css("color", "rgb(" + R_HQ_WZ + "," + G_HQ_WZ + "," + B_HQ_WZ + ")")
			if (R_HQ_WZ <= 102 && G_HQ_WZ <= 102 && B_HQ_WZ <= 102) {
				clearInterval(time2_RGB_HQ_WZ);
			}
		})
	})
	//获取验证效果
	var jishu_HQ = 0;
	var time1_HQ = setInterval(function () { });
	var time2_HQ = setInterval(function () { });
	$(".YanZ").mouseenter(function () {
		clearInterval(time2_HQ);
		time1_HQ = setInterval(function () {
			$(".YanZ").css("box-shadow", "0px 0px " + jishu_HQ + "px 0px red")
			jishu_HQ++;
			if (jishu_HQ >= 30) {
				clearInterval(time1_HQ);
			}
		}, 5)
	}).mouseleave(function () {
		clearInterval(time1_HQ);
		time2_HQ = setInterval(function () {
			$(".YanZ").css("box-shadow", "0px 0px " + jishu_HQ + "px 0px red")
			jishu_HQ--;
			if (jishu_HQ <= 0) {
				clearInterval(time2_HQ);
			}
		}, 10)
	})
	var Text_XianShi1 = function (DuiXiang, Text) {
		if ($(DuiXiang).val() == Text) {
			$(DuiXiang).val("");
			$(DuiXiang).toggleClass("color_Hui color_Hei");
		}
	}
	var Text_XianShi2 = function (DuiXiang, Text) {
		if ($(DuiXiang).val() == Text || $(DuiXiang).val() == "") {
			$(DuiXiang).toggleClass("color_Hui color_Hei");
			$(DuiXiang).val(Text);
		}
	}
	//账号
	$(".YongHuMing").val("账号");
	$(".YongHuMing").focus(function () {
		$(".YouXiang").css("margin-top", "16px");
		Text_XianShi1(this, "账号");
		$(".YongHuMingPanDuan").text("");
	}).blur(function () {
		Text_XianShi2(this, "账号");
		//判断账号
		var number = $(this).val();
		if ((isNaN(number) == true && number != "账号")) {
			$(".YongHuMingPanDuan").text("账号类型不正确");
			$(".YouXiang").css("margin-top", "8px");
		}
	})
	//邮箱
	$(".YouXiang").val("邮箱");
	$(".YouXiang").focus(function () {
		$(".YanZhengMa").css("margin-top", "16px");
		Text_XianShi1(this, "邮箱");
		$(".YouXiangPanDuan").text("");
	}).blur(function () {
		Text_XianShi2(this, "邮箱");
		var search_str = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
		var email_val = $(".YouXiang").val();
		if (!search_str.test(email_val) && $(".YouXiang").val() != "邮箱") {
			$(".YouXiangPanDuan").text("邮箱格式不正确");
			$(".YanZhengMa").css("margin-top", "8px");
		} else {
			$(".YouXiangPanDuan").text("");
		}
		if ($(".YouXiang").val() == "邮箱" || $(".YouXiang").val() == "") {
			$(".YouXiangPanDuan").text("");
		}
	})
	//验证码
	$(".YanZhengMa").val("验证码");
	$(".YanZhengMa").focus(function () {
		Text_XianShi1(this, "验证码");
		$(".YanZhengMaPanDuan").text("");
	}).blur(function () {
		Text_XianShi2(this, "验证码");
	})
	//悬浮文本框泛光
	var jishu_YHM = 0;
	var time1_YHM = setInterval(function () { });
	var time2_YHM = setInterval(function () { });
	$(".YongHuMing").mouseenter(function () {
		clearInterval(time2_YHM);
		time1_YHM = setInterval(function () {
			$(".YongHuMing").css("box-shadow", "0px 0px " + jishu_YHM + "px 0px #00BCD4")
			jishu_YHM++;
			if (jishu_YHM >= 30) {
				clearInterval(time1_YHM);
			}
		}, 5)
	}).mouseleave(function () {
		clearInterval(time1_YHM);
		time2_YHM = setInterval(function () {
			$(".YongHuMing").css("box-shadow", "0px 0px " + jishu_YHM + "px 0px #00BCD4")
			jishu_YHM--;
			if (jishu_YHM <= 0) {
				clearInterval(time2_YHM);
			}
		}, 10)
	})
	var jishu_YX = 0;
	var time1_YX = setInterval(function () { });
	var time2_YX = setInterval(function () { });
	$(".YouXiang").mouseenter(function () {
		clearInterval(time2_YX);
		time1_YX = setInterval(function () {
			$(".YouXiang").css("box-shadow", "0px 0px " + jishu_YX + "px 0px #00BCD4")
			jishu_YX++;
			if (jishu_YX >= 30) {
				clearInterval(time1_YX);
			}
		}, 5)
	}).mouseleave(function () {
		clearInterval(time1_YX);
		time2_YX = setInterval(function () {
			$(".YouXiang").css("box-shadow", "0px 0px " + jishu_YX + "px 0px #00BCD4")
			jishu_YX--;
			if (jishu_YX <= 0) {
				clearInterval(time2_YX);
			}
		}, 10)
	})
	var jishu_YZ = 0;
	var time1_YZ = setInterval(function () { });
	var time2_YZ = setInterval(function () { });
	$(".YanZhengMa").mouseenter(function () {
		clearInterval(time2_YZ);
		time1_YZ = setInterval(function () {
			$(".YanZhengMa").css("box-shadow", "0px 0px " + jishu_YZ + "px 0px #00BCD4")
			jishu_YZ++;
			if (jishu_YZ >= 30) {
				clearInterval(time1_YZ);
			}
		}, 5)
	}).mouseleave(function () {
		clearInterval(time1_YZ);
		time2_YZ = setInterval(function () {
			$(".YanZhengMa").css("box-shadow", "0px 0px " + jishu_YZ + "px 0px #00BCD4")
			jishu_YZ--;
			if (jishu_YZ <= 0) {
				clearInterval(time2_YZ);
			}
		}, 10)
	})
	var jishu_But1 = 0;
	var time1_But1 = setInterval(function () { });
	var time2_But1 = setInterval(function () { });
	$(".but1").mouseenter(function () {
		clearInterval(time2_But1);
		time1_But1 = setInterval(function () {
			$(".but1").css("box-shadow", "0px 0px " + jishu_But1 + "px 0px #00BCD4")
			jishu_But1++;
			if (jishu_But1 >= 30) {
				clearInterval(time1_But1);
			}
		}, 5)
	}).mouseleave(function () {
		clearInterval(time1_But1);
		time2_But1 = setInterval(function () {
			$(".but1").css("box-shadow", "0px 0px " + jishu_But1 + "px 0px #00BCD4")
			jishu_But1--;
			if (jishu_But1 <= 0) {
				clearInterval(time2_But1);
			}
		}, 10)
	})
	//验证码
	$(".YanZhengMa").val("验证码");
	$(".YanZhengMa").focus(function () {
		Text_XianShi1(this, "验证码");
		$(".YanZhengMaPanDuan").text("");
	}).blur(function () {
		Text_XianShi2(this, "验证码");
	})
	//密码
	var MiMa_TiShi = "密码                      长度大于6位数";
	$(".MiMa1").val(MiMa_TiShi);
	$(".MiMa1").focus(function () {
		Text_XianShi1(this, MiMa_TiShi);
	}).blur(function () {
		Text_XianShi2(this, MiMa_TiShi);
	})
	//重复密码
	$(".MiMa2").val("重复密码");
	$(".MiMa2").focus(function () {
		Text_XianShi1(this, "重复密码");
	}).blur(function () {
		Text_XianShi2(this, "重复密码");
	})
	var jishu_MM1 = 0;
	var time1_MM1 = setInterval(function () { });
	var time2_MM1 = setInterval(function () { });
	$(".MiMa1").mouseenter(function () {
		$(".Tishi>span").text("");
		clearInterval(time2_MM1);
		time1_MM1 = setInterval(function () {
			$(".MiMa1").css("box-shadow", "0px 0px " + jishu_MM1 + "px 0px #00BCD4")
			jishu_MM1++;
			if (jishu_MM1 >= 30) {
				clearInterval(time1_MM1);
			}
		}, 5)
	}).mouseleave(function () {
		clearInterval(time1_MM1);
		time2_MM1 = setInterval(function () {
			$(".MiMa1").css("box-shadow", "0px 0px " + jishu_MM1 + "px 0px #00BCD4")
			jishu_MM1--;
			if (jishu_MM1 <= 0) {
				clearInterval(time2_MM1);
			}
		}, 10)
	})
	var jishu_MM2 = 0;
	var time1_MM2 = setInterval(function () { });
	var time2_MM2 = setInterval(function () { });
	$(".MiMa2").mouseenter(function () {
		$(".Tishi>span").text("");
		clearInterval(time2_MM2);
		time1_MM2 = setInterval(function () {
			$(".MiMa2").css("box-shadow", "0px 0px " + jishu_MM2 + "px 0px #00BCD4")
			jishu_MM2++;
			if (jishu_MM2 >= 30) {
				clearInterval(time1_MM2);
			}
		}, 5)
	}).mouseleave(function () {
		clearInterval(time1_MM2);
		time2_MM2 = setInterval(function () {
			$(".MiMa2").css("box-shadow", "0px 0px " + jishu_MM2 + "px 0px #00BCD4")
			jishu_MM2--;
			if (jishu_MM2 <= 0) {
				clearInterval(time2_MM2);
			}
		}, 10)
	})

	var jishu_But2 = 0;
	var time1_But2 = setInterval(function () { });
	var time2_But2 = setInterval(function () { });
	$(".TiJiao_XG").mouseenter(function () {
		clearInterval(time2_But2);
		time1_But2 = setInterval(function () {
			$(".TiJiao_XG").css("box-shadow", "0px 0px " + jishu_But2 + "px 0px #00BCD4")
			jishu_But2++;
			if (jishu_But2 >= 30) {
				clearInterval(time1_But2);
			}
		}, 5)
	}).mouseleave(function () {
		clearInterval(time1_But2);
		time2_But2 = setInterval(function () {
			$(".TiJiao_XG").css("box-shadow", "0px 0px " + jishu_But2 + "px 0px #00BCD4")
			jishu_But2--;
			if (jishu_But2 <= 0) {
				clearInterval(time2_But2);
			}
		}, 10)
	})
	//关闭
	$(".GuanBi").click(function () {
		$(".emmm").html("");
	})


})
